function y = cosine(x)
% COSINE function
% x0=ones(n,1);
n=length(x); y=0;
for i=1:n-1
    y=y+cos(-0.5*x(i+1)+(x(i))^2);
end


